package com.wondersgroup.wuhan_demo.ui;

import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.wondersgroup.wuhan_demo.MyApplication;
import com.wondersgroup.wuhan_demo.R;
import com.wondersgroup.wuhan_demo.base.BaseFragment;
import com.wondersgroup.wuhan_demo.util.SPUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class PayFragment extends BaseFragment {

    @BindView(R.id.tv_kh)
    TextView tvKh;
    @BindView(R.id.tv_money)
    TextView tvMoney;
    @BindView(R.id.iv_zfb)
    ImageView ivZfb;
    @BindView(R.id.iv_wx)
    ImageView ivWx;
    @BindView(R.id.money)
    TextView money;
    @BindView(R.id.iv_sk)
    ImageView ivSk;
    Unbinder unbinder;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_pay, container, false);
        unbinder = ButterKnife.bind(this, view);
        Resources resources =getContext().getResources();
        String kh = (String) SPUtils.get(getContext(), resources.getString(R.string.kh), "");
        tvKh.setText(kh);
        tvMoney.setText("0.01");
        return view;
    }

    @OnClick({R.id.iv_zfb, R.id.iv_wx, R.id.iv_sk})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_zfb:
                addFragment(new PaySuccFragment());
                break;
            case R.id.iv_wx:
                addFragment(new PaySuccFragment());
                break;
            case R.id.iv_sk:
                addFragment(new PaySuccFragment());
                break;
        }
    }
    @Override
    public void onResume() {
        super.onResume();
        LaunchActivity launchActivity=(LaunchActivity)getActivity();
        launchActivity.setTopPosition(0);
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
